<?php
/**
 * User: fu
 * Date: 12-3-20
 * Time: 上午11:34
 */
require 'lib/lib.php';
include 'islogin.php';

$actinfo='';
$include_src='';
$f_title='';
$act=isset($_GET['act'])?$_GET['act']:'';
$aid=isset($_GET['aid'])?$_GET['aid']:0;
$attach= new Attach();

switch ($act){
    case 'add':{
        if(isset($_POST['aname']) && isset($_POST['afile'])&&isset($_POST['atpl'])){

            if($attach->add($_POST['aname'],$_POST['afile'],$_POST['atpl'])){
                $actinfo=Fun::echoinfo('添加成功！','succeed');
            }else{
                $actinfo=Fun::echoinfo($attach->errorinfo[2],'error');
            }

        }

        $include_src = 'attach_add.php';
        break;
    }
    case 'alt':{

        if(isset($_POST['aname']) && isset($_POST['afile'])&&isset($_POST['atpl'])){
            if($attach->alt($_POST['aname'],$_POST['afile'],$_POST['atpl'],$aid)){
                $actinfo = Fun::echoinfo('修改成功','succeed');
            }else{
                $actinfo=Fun::echoinfo($curfiled->errorinfo[2],'error');
            }

        }
        $include_src = 'attach_alt.php';
        break;
    }
    case 'del':{
        if( isset($_GET['confirm'])&&$_GET['confirm']==='yes'){
            if($attach->del($aid)){
                $actinfo = Fun::echoinfo('删除成功','succeed');
            }else{
                $actinfo=Fun::echoinfo($attach->errorinfo[2],'error');
            }

        }
        $include_src = 'attach_del.php';
        break;
    }

    default:{
        $include_src = 'attach_show.php';
    }
}
include ADMIN_ABS_TPL_SRC.'index.php';
